<?php

require_once __DIR__.'/../config.php';
require_once __DIR__.'/class_filter.php';

ini_set('display_errors',1);
error_reporting(E_ALL & ~E_NOTICE);

$uri=$_SERVER['REQUEST_URI'];

$params = explode('?', $uri);
$params = explode('/', trim($params[0], '/'));
//var_dump($params);
$params_len = count($params);

if($params[0] == 'api'){
    if($params_len == 1){
        require_once ABSPATH .'app/api/index.php';
        exit();
    }else{
        $request_file = ABSPATH .'app/api/'.$params[1].'.php';
        if(file_exists($request_file)){
            FILTER::permissions_filtering($params,$_SERVER['HTTP_ACCESS_TOKEN']);
            //require_once $request_file;
            exit();
        }
    }
    
}
    
http_response_code(404);
require_once ABSPATH .'public/nepadmin/views/exception/404.html';
